﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace ChatService
{
    [ServiceContract]
    public interface IGetChanelMessages
    {

        [OperationContract]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json)]
        IEnumerable<String> GetChanels();

        [OperationContract]
        [WebInvoke(Method = "GET",
        UriTemplate = "/GetMessages/{numberOfMessages}/{chanelName}")]
        IEnumerable<MessageDTO> GetMessages(string numberOfMessages, string chanelName);


        [OperationContract]
        [WebInvoke(Method = "GET",
        UriTemplate = "/Create/{chanelName}")]
        void CreateChanel(string chanelName);

        [OperationContract]
        [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        void PostMessage(Post newPost);

    }
    [DataContract]
    public class Post
    {
        [DataMember]
        public string Chanel { get; set; }

        [DataMember]
        public string Message { get; set; }
    }
}
